/*
 * Copyright (c) 2006, 2021, webrx.cn All rights reserved.
 *
 */
package cn.webrx;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * <p>Project: javaseapp - Reg1
 * <p>Powered by webrx On 2021-08-06 16:14:25
 * <p>Created by IntelliJ IDEA
 *
 * @author webrx [webrx@126.com]
 * @version 1.0
 * @since 16
 */
public class Reg5 {
    public static void main(String[] args) {
        //检测一个字符串有多少数字
        String str = "java18html5php23pyth-6on89";

        // ^ 开关 $结尾 * 0个或多个 . 1个任意字符 + 1个或多个字符 ?   [a-f]+
        Pattern p = Pattern.compile("-?\\d+");
        Matcher m = p.matcher(str);
        int sum = 0;
        while (m.find()) {
            sum += Integer.parseInt(m.group());
        }
        System.out.println(sum);


    }
}
